import { _decorator, AudioSource, Component, Input, input, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('BgBgmContreoll')
export class BgBgmContreoll extends Component {
    start() {
        console.log('启动了');
        // input.on(Input.EventType.TOUCH_START,this.onstartButton,this);

    }

    onstartButton(){
        console.log('点击了');
       let audioSource  = this.node.getComponent(AudioSource);
       if(audioSource.playing){
        console.log('暂停');
        audioSource.pause();
       }else{
        console.log('开始播放');
        audioSource.play();
       }
    }

    update(deltaTime: number) {
        
    }
}

